package org.liujing.jsw.client.ui;

import java.util.*;
import org.liujing.jsw.client.ui.plaf.*;
import com.google.gwt.core.client.GWT;

public class UIManager{
	
	static Map<Class, ComponentUIFactory> defaultUIs = new HashMap();
	
	static DefaultUIFactory factory = new DefaultUIFactory();
	
	static{
		defaultUIs.put(JLabel.class, new LabelUI.Factory());
		//defaultUIs.put(ImageIcon.class, new ImageIcon.UIFactory());
	}
	
	public static ComponentUI getUI(JComponent target) {
			
			ComponentUIFactory fa = defaultUIs.get(target.getClass());
			if(fa == null)
				fa = factory;
			return fa.createUI();
	}
	
	static class DefaultUIFactory implements ComponentUIFactory{
		ComponentUI ui = new ComponentUI();
		
		public ComponentUI createUI(){
			return ui;
		}
	}
}
